import responses
import requests, unittest


class responsesTest(unittest.TestCase):
    def setUp(self):
        pass

    def tearDown(self):
        pass

    @responses.activate
    def test_simple1(self):
        responses.add(responses.GET, 'http://twitter.com/api/1/foobar',
                      json={'error': 'not found'}, status=404)
        url = 'http://twitter.com/api/1/foobar'
        r = requests.get(url)
        print(r.json())
        self.assertEqual(r.json()['error'], 'not found')


if __name__ == '__main__':
    unittest.main()
